Circles
Memory limit: 128 MB
The farmers of Byteland will remember the last summer for a long time.
Usually a summer burns into one's memory due to
plentiful harvest, severe drought or hail.
However the last summer was so extraordinary because of strange shapes,
which appeared at several wheat fields.
As a Bytean expert in all unusual problems, Byteasar decided to
explain this phenomenon on the ground of science.
In order to do this, he thoroughly inspected each wheat field
and noticed that each shape was made by crumbling all wheat
belonging to a circular region.
Every two circles touch in at most one point (in particular
no circle can be contained in a different circle).
Byteasar suspects that the circles describe messages sent by
aliens.
Unfortunately, understanding their language is very hard.
At this point Byteasar collected all the information about
the shapes he found and he is going to use
some tools of statistical analysis.
The more interesting data he collects, the better.
Byteasar asked you to write a program, which given
the description of all the circles computes
the number of pairs of circles having a common point.
Input
The first line of input contains a single integer (),
the number of circles.
Each of the following lines describes a circle.
In the -th of those lines there are three integers (,
),
meaning that the center of the -th circle has coordinates
while its radius equals .
Output
Your program should output the number of pairs of circles having
a common point.
Example
For the input data:
4
0 0 5
8 6 5
-6 8 5
2 14 5
the correct result is:
4
Task author: Jakub Lacki.